package com.greatchn.no_session_auth_code.web.controller;

import com.greatchn.no_session_auth_code.util.Result;
import com.greatchn.no_session_auth_code.web.srv.LoginSrv;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @LoginController: login ctrl
 * @author: ZBoHang
 * @time: 2023/2/8 13:56
 */
@RestController
@RequestMapping("/login")
public class LoginController {

    @Resource
    private LoginSrv loginSrv;

    /**
     * 登录
     */
    @PostMapping("login")
    public Result login(String userName, String passWord) {
        // TODO: 2023/2/8 跳过验证
        String token = this.loginSrv.createToken(userName);

        return Result.success(token);
    }
}
